﻿using System;
using System.Data;
using System.Data.Common;
using System.Text;
using Besture.Common;
using Besture.Model;

namespace Besture.Dal
{
    public partial class HotelsFacilitiesDal : BaseDataAccess
    {
       /// <summary>
       /// 根据酒店ID获取数据
       /// </summary>
       /// <param name="hotelsId"></param>
       /// <returns></returns>
        public DataTable GetDataTableByHotelsId(int hotelsId)
        {
            try
            {
                StringBuilder selectSql = new StringBuilder();
                selectSql.Append(string.Format(@"
                SELECT hf.FacilitiesID,hc.CategoryName FROM dbo.TBHotelsFacilities hf
                INNER JOIN dbo.TBHotelsCategory hc ON hc.ID=hf.FacilitiesID AND hc.IsDeleted=0 AND hf.IsDeleted=0 AND hc.CategoryType=6
                WHERE hf.HotelsID={0}
                ORDER BY hf.CreateTime DESC ",hotelsId));
                DbCommand ldcDBCommand = base.GetCommand(selectSql.ToString());
                DataTable dt = base.GetDataSet(ldcDBCommand).Tables[0];
                return dt;
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
    }
}

